package com.morning.dp.tools.dp;

import com.morning.dp.tools.dp.context.ParameterizeContext;

/**
 * BaseDesignPattern
 *
 * @author @阿秋
 * @date 2021/2/4
 */
public abstract class BaseDesignPattern<DP extends BaseDesignPattern> {

    protected ParameterizeContext paramContext;

    protected BaseDesignPattern(ParameterizeContext paramContext) {
        this.paramContext = paramContext;
    }

    @SuppressWarnings("unchecked")
    public DP withParam(String paramName, Object param) {
        paramContext.setParam(paramName, param);
        return (DP) this;
    }

    @SuppressWarnings("unchecked")
    public DP withParam(Object param) {
        paramContext.setParam(param);
        return (DP) this;
    }
}
